import { createApp, provide } from 'vue'
import * as ElementPlusIconsVue from "@element-plus/icons-vue"
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import tools from '@/utils/tools.js'
import { myAxios, otherAxios } from '@/axios'
import './style.css'

// 创建pinia实例
const pinia = createPinia()

// 构建Vue
const app = createApp(App)

// 将示例对象挂载到Vue全局，方便调用，不用重复构造重复引入
app.config.globalProperties.$axios = myAxios
app.config.globalProperties.$elaxios = otherAxios
app.config.globalProperties.$tools = tools
// provide提供,组合式API才能用
app.provide('$axios', myAxios)
app.provide('$elaxios', otherAxios)
app.provide('$tools', tools)


// 引入Element-plus库的小图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
  
app.use(router).use(pinia).use(ElementPlus).mount("#app")
